package util;

import java.io.File;

public class ProcessFiles {
	
	interface Strategy{
		public void process(File file);
	}
	
	Strategy strategy;
	
	public ProcessFiles(Strategy strategy) {
		super();
		this.strategy = strategy;
	}

	public void start(String[] args){
		for(String arg : args){
			File path = new File(arg);
			
			if(path.isDirectory())
				processDir(path);
			else
				strategy.process(path);			
		}
	}
	
	public void processDir(File root){
		for(File file : root.listFiles())
			strategy.process(file);
	}
	
	public static void main(String[] args){
		
		new ProcessFiles(new Strategy() {
			public void process(File file) {
				System.out.println(file);
			}
		}).start(args);
	}

}
